import React from 'react';
import ReactDOM from 'react-dom';
import {Router, hashHistory} from 'react-router';
import {createStore, applyMiddleware, compose } from 'redux'
import {Provider} from 'react-redux';
import {routerMiddleware, syncHistoryWithStore} from 'react-router-redux';
import thunk from 'redux-thunk';
import routes from './routes'
import reducers from './reducers'
import 'element-theme-default';


const middleware = routerMiddleware(hashHistory);
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(reducers,
    composeEnhancers(applyMiddleware(thunk,middleware)));

const history = syncHistoryWithStore(hashHistory, store);
console.log('store', store);
ReactDOM.render(
  <Provider store={store}>
    <Router history={history}>
      {routes(store)}
    </Router>
  </Provider>,
  document.getElementById('root')
);